package languageacquisition;

import languageacquisition.ontology.LanguageSymbol;
import languageacquisition.ontology.Property;

import org.jfree.data.time.Millisecond;
import org.jfree.ui.RefineryUtilities;

import com.sun.java_cup.internal.runtime.Symbol;

public class NewAgent extends PopulationAgent {

	private static final long serialVersionUID = -218348168977773781L;
	boolean chartVisible = true;

	// choosen word to display process of learning
	Property propToChart;

	DynamicChart demo;

	public void setup() {
		learning = true;
		super.setup();

		if (chartVisible) {
			demo = new DynamicChart("Language Process for agent "
					+ this.getLocalName(), properties.size());
//			propToChart = new Property((int) Integer
//					.parseInt((String) getArguments()[3]));
			propToChart = new Property(Integer.parseInt((String) getArguments()[3]));
			showChart();
		}

	}

	public void showChart() {
		demo.pack();
		RefineryUtilities.centerFrameOnScreen(demo);
		demo.setVisible(true);

	}

	@Override
	protected void takeDown() {
		super.takeDown();
	}

	public void updateChartSeries(double[] factor) {
		for (int i = 0; i < factor.length; i++)
			demo.series[i].addOrUpdate(new Millisecond(), factor[i]-0.004+i*0.001);
	}

}
